var wechat = require('wechat');
var API = require('wechat').API;
var appID = process.env.wechat_appid || 'wx6830868e205d73e2';
var appsecret = process.env.wechat_appsecret || '33bee4d780be6cdc2fd48def679548ab';
var api = new API(appID, appsecret);
var OAuth = require('wechat-oauth');
var oauth = new OAuth(appID, appsecret);

// 公众平台类
var PublicPlatform = {

	//平台机器人-自动回复
	robot: wechat('menpuji').text(function (message, req, res, next) {
		res.reply("欢迎使用孙记膳房！!");

	})
		.image(function (message, req, res, next) {

		})
		.voice(function (message, req, res, next) {

		})
		.video(function (message, req, res, next) {

		})
		.location(function (message, req, res, next) {

		})
		.link(function (message, req, res, next) {

		}).event(function (message, req, res, next) {


		}).middlewarify(),

	//微信公众平台API
	api: api,
	//微信公众平台OAuth授权
	oauth: oauth,
	appId: appID,
	appsecret: appsecret
}

module.exports = PublicPlatform;